﻿/**
 * ...
 * @author kex
 */

package ;

import flash.display.Sprite;
import flash.ui.Keyboard;
import flash.events.Event;
import gui.hug.HUGButton;
import gui.hug.HUGColors;
import gui.hug.HUGEditField;
import gui.hug.HUGListBox;
import gui.hug.HUGPopupWindow;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;


class MyList 
{
	private var window 	: Sprite;
	private var list	: HUGListBox;
	
	private inline static var listDefaultContent 	: Array < String > =
				[	"press the button - " + MyButton.DOWN + " circles" ,
					"release the button - " + MyButton.UP + " circles" ,
					"target the button - " + MyButton.OVER + " circles" , 
					"untarget the button - " + MyButton.OUT + " cirles" , 
					"mousewheel over the button - " + MyButton.WHEEL + " circle" , 
					"move mouse over the button - " + MyButton.MOVE + " circle for each pixel"
				];

	public function new(instance : Sprite, x:Int, y:Int, width:Int) {
		window = instance;

		list = new HUGListBox(x, y, width);
		list.addItemsArray(listDefaultContent);
		window.addChild(list);
		list.addEventListener(KeyboardEvent.KEY_DOWN, listEvent);
	}
	
	/*** OPEN MY POP UP WINDOW ***/
	private function listEvent(e:KeyboardEvent) {
		if (e.keyCode == Keyboard.ENTER) {
			var pop : PopUpWindowManager = new PopUpWindowManager(window, list, list.getSelectedIndex());
		}
	}
}